﻿/**
 * 
 */
package com.roc.dao.impl;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.roc.dao.DaoException;
import com.roc.dao.IUserDao;
import com.roc.pojo.User;
import com.roc.util.Utils;

/**
 * @author Administrator
 * 
 */
@Repository
public class UserDaoImpl extends BaseDaoImpl implements IUserDao {

	public User findUserById(String id) throws DaoException {
		if (Utils.isBlank(id)) {
			throw new DaoException("查询的用户ID为空");
		}
		Session session = sessionFactory.getCurrentSession();
		User user = (User) session.get(User.class, id);
		return user;
	}

	public void addUser(User user) throws DaoException {
		edit(user);
	}

	public void deleteUser(User user) throws DaoException {
		delete(user);
	}

	public void updateUser(User user) throws DaoException {
		edit(user);
	}
}
